//https://leetcode.cn/problems/min-stack/description/
//最小栈

class MinStack {
public:
    MinStack() {}
    
    void push(int val) {
        if(_stMin.empty() || val <= _stMin.top())
            _stMin.push(val);
        _stData.push(val);
    }
    
    void pop() {
        if(_stData.top() == _stMin.top())
            _stMin.pop();
        _stData.pop();
    }
    
    int top() {
        return _stData.top();
    }
    
    int getMin() {
        return _stMin.top();
    }

private:
    stack<int> _stData;
    stack<int> _stMin;
};